# Maintainer: Laurent Carlier <lordheavym@gmail.com>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: geekitus

pkgname=blobwars
pkgver=2.00
pkgrel=4
pkgdesc="Platform action game featuring a blob wih lot of weapons"
arch=('loong64' 'x86_64')
url="https://sourceforge.net/projects/blobwars"
license=('GPL')
makedepends=('sdl2_image' 'sdl2_mixer' 'sdl2_ttf' 'sdl2_net')
source=(https://downloads.sourceforge.net/project/$pkgname/$pkgname-$pkgver.tar.gz)
sha256sums=('c406279f6cdf2aed3c6edb8d8be16efeda0217494acd525f39ee2bd3e77e4a99')

prepare() {
  cd blobwars-${pkgver}

  # use install instead of mkdir/cp
  sed -i -e 's/mkdir -p/install -dm755/g' \
    -e 's/cp -pr/cp -r/g' \
    -e 's/cp -p /install -m644 /g' Makefile
  # Don't use -Werror
  sed -e 's|-Werror||' -i Makefile
}

build() {
  cd blobwars-${pkgver}

  make RELEASE=1
}

package() {
  depends=('hicolor-icon-theme' 'sdl2_image' 'sdl2_mixer' 'sdl2_ttf' 'sdl2_net' 'blobwars-data>=2.0')

  cd blobwars-${pkgver}

  make DESTDIR="${pkgdir}" BINDIR="/usr/bin/" install

  # We remove data files (See blobwars-data)
  rm -r "${pkgdir}/usr/share/games"
}

